﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using X.Web;

namespace X.WebSite.Admin.Param
{
    public partial class SiteInfo : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                X.Entity.SiteInfo siteInfo = Bll.Params.GetSiteInfo();
                txtSiteName.Text = X.Common.StringUtils.HtmlDecode(siteInfo.SiteName);
                txtSiteUrl.Text = siteInfo.SiteUrl;
                txtTitle.Text = X.Common.StringUtils.HtmlDecode(siteInfo.SiteTitle);
                txtKeyword.Text = siteInfo.SiteKeyword;
                txtDescription.Text = siteInfo.SiteDescription;
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            X.Entity.SiteInfo siteInfo = Bll.Params.GetSiteInfo();
            siteInfo.SiteName = X.Common.StringUtils.HtmlEncode(txtSiteName.Text);
            siteInfo.SiteUrl = txtSiteUrl.Text;
            siteInfo.SiteTitle = X.Common.StringUtils.HtmlEncode(txtTitle.Text);
            siteInfo.SiteKeyword = txtKeyword.Text;
            siteInfo.SiteDescription = txtDescription.Text;

            Bll.Params.UpdataSiteInfo(siteInfo);

            Response.Redirect("../Right.aspx");
        }
    }
}